﻿//
//  Monkey Manager
//  Copyright (C) 2010 Victor Tereschenko (aka sibvic)
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
//     
// ========================================================================

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MonkeyManager
{
    public delegate void PlayerActionSimpleDelegate(PlayerWindow sender);

    /// <summary>
    /// Helps players to monitor behavior and commands of each other.
    /// </summary>
    public class PlayersController
    {
        public event PlayerActionSimpleDelegate OnPlay;
        public event PlayerActionSimpleDelegate OnStop;
        public event PlayerActionSimpleDelegate OnActivated;
        public event PlayerActionSimpleDelegate OnMaximized;
        public event PlayerActionSimpleDelegate OnDemaximized;
        public event PlayerActionSimpleDelegate OnClosed;

        /// <summary>
        /// Starts all players.
        /// </summary>
        public void Play(PlayerWindow sender)
        {
            if (OnPlay != null)
                OnPlay(sender);
        }

        /// <summary>
        /// Stops all players.
        /// </summary>
        public void Stop(PlayerWindow sender)
        {
            if (OnStop != null)
                OnStop(sender);
        }

        public void SendActivated(PlayerWindow sender)
        {
            if (OnActivated != null)
                OnActivated(sender);
        }

        public void SendMaximized(PlayerWindow sender)
        {
            if (OnActivated != null)
                OnMaximized(sender);
        }

        public void SendDemaximized(PlayerWindow sender)
        {
            if (OnActivated != null)
                OnDemaximized(sender);
        }

        public void SendClosed(PlayerWindow sender)
        {
            if (OnActivated != null)
                OnClosed(sender);
        }
    }
}
